/***********************************************************
 *  File_Name  : XJStringUtil.h
 *  File_Path   : 
 *  File_Encode : UTF8
 *  Description : 字段串相关函数
 *  
 *  OS : Linux, UNIX
 *  LastVersion  : 20130117
 *      
 *  Author      : LiXiujie(李秀杰)
 *  Date        : 2013-1-17
 *  Version     : 20130117
 *  Description : 
 *                
 *  Edit Author : 
 *  Edit Date   : 
 *  Version     : 
 *  Description :
 *                
 ***********************************************************/
#ifndef XJSTRINGUTIL_H_
#define XJSTRINGUTIL_H_

#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <cstdio>
#include <sstream>
using namespace std;

namespace XJUtilClass{
class XJStringUtil {
public:
	XJStringUtil();
	virtual ~XJStringUtil();
public:
	static vector<string> &Split(vector<string> &veStr, const string &strSource, const string &strSeparator);
	static string &TrimHeadTail(string &strSource, const char ch = ' ');
	static string &Replace(string &strSource, const string &strFindStr, const string &strReplace);
	static vector<string> &FindSubstr(vector<string> &veStr, const string &strSource,
			const string &strFindBegin, const string &strFindEnd,
			const bool bIsIncludeFindStr = false, const unsigned long ulFindIndex=0,
			const unsigned long ulFindSize = string::npos);
	static string &Uppercase(string &strSource);
	static string &Lowercase(string &strSource);
	static string FromLong(long lNum);
	static string FromDouble(double dNum, unsigned long nLen = 6, bool bRoundingOff = true);
	static string FromLongLong(long long llNum);
	static string FromLongDouble(long double ldNum, unsigned long nLen = 6, bool bRoundingOff = true);
	static string FromULong(unsigned long lNum);

	static string FromULongLong(unsigned long long llNum);

	static short ToShort(const string &strNum);
	static int ToInt(const string &strNum);
	static long ToLong(const string &strNum);
	static float ToFloat(const string &strNum);
	static double ToDouble(const string &strNum);
	static long long ToLongLong(const string &strNum);
	static long double ToLongDouble(const string &strNum);
	static unsigned short ToUShort(const string &strNum);
	static unsigned int ToUInt(const string &strNum);
	static unsigned long ToULong(const string &strNum);

	static unsigned long long ToULongLong(const string &strNum);
	static bool IsNum(const string &strNum);
	static bool IsShort(const string &strNum);
	static bool IsInt(const string &strNum);
	static bool IsLong(const string &strNum);
	static bool IsFloat(const string &strNum);
	static bool IsDouble(const string &strNum);
	static bool IsLongLong(const string &strNum);
	static bool IsLongDouble(const string &strNum);
	static bool IsUShort(const string &strNum);
	static bool IsUInt(const string &strNum);
	static bool IsULong(const string &strNum);
	static bool IsUDouble(const string &strNum);
	static bool IsULongLong(const string &strNum);
	static bool IsULongDouble(const string &strNum);
	static bool Isaz(const string &strSource);
	static bool IsAZ(const string &strSource);
	static bool IsAZaz(const string &strSource);
	static bool IsAZaz09(const string &strSource);
};
typedef class XJStringUtil XJSU;
} /* namespace XJUtilClass */
#endif /* XJSTRINGUTIL_H_ */
